package dao;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import model.Rodada;
import interfaces.IRodada;

public class DaoRodada extends DaoGenerico<Rodada> implements IRodada{

	@Override
	public Rodada getPorId(Long id) {
		Session session = this.getSession();
		Criteria criteria = session.createCriteria(Rodada.class);
		criteria.add(Restrictions.eq("id", id));
		Rodada r = (Rodada) criteria.uniqueResult();
		session.close();
		return r;
	}

	@Override
	public Rodada getRodadas(String rodadas) {
		Session session = this.getSession();
		Criteria criteria = session.createCriteria(Rodada.class);
		criteria.add(Restrictions.eq("rodadas", rodadas));
		Rodada r = (Rodada) criteria.uniqueResult();
		session.close();
		return r;
	}

}
